package com.adingxiong.pm.config;

import liquibase.integration.spring.SpringLiquibase;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * @ClassName LiquibaseConfig
 * @Description liqiubase  配置累
 * @Author xiongchao
 * @Date 2020/5/7 22:10
 **/
@Configuration
public class LiquibaseConfig {

    @Bean
    public SpringLiquibase liquibase (DataSource dataSource){
        SpringLiquibase liquibase = new SpringLiquibase();
        liquibase.setDataSource(dataSource);
        //指定changeLog 的位置  这里使用一个master文件引用其他文件的方式
        liquibase.setChangeLog("classpath:liquibase/master.xml");
        liquibase.setContexts("development,test,production");
        liquibase.setShouldRun(true);
        return liquibase;
    }
}
